<?php

use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use backend\modules\i18n\models\I18nSourceMessage;


/* @var $this yii\web\View */
/* @var $model backend\modules\i18n\models\I18nSourceMessage */
/* @var $form yii\bootstrap\ActiveForm */
?>
<?php
    
    $connection = \Yii::$app->db;
    $sql = "select distinct language from i18n_message";
    $sql2 = "select distinct category from i18n_source_message";
    $command = $connection->createCommand($sql);
    $command2 = $connection->createCommand($sql2);
    $language = $command->queryAll();
    $category = $command2->queryAll();
    foreach ($language as $val){
        $languageArr[$val['language']]=$val['language'];
    }
    foreach ($category as $val){
        $categoryArr[$val['category']]=$val['category'];
    }
//    $I18nSourceMessage = I18nSourceMessage::find()->select("category")->distinct()->asArray()->one();
//    var_dump($I18nSourceMessage);exit;
?>
<div class="i18n-source-message-form" style="height:200px;">
    
    <?php $form = ActiveForm::begin(); ?>
    <div class="col-sm-4">
        <?php echo $form->field($model, 'category')->dropDownList($categoryArr,['class' => 'dropDown']) ?>
    </div>
    
    <div class="col-sm-4">
        <?php echo $form->field($model, 'language')->dropDownList($languageArr,['class' => 'dropDown']) ?>
    </div>
    
    <div class="col-sm-4"> 
        <?php echo $form->field($model, 'message')->textInput() ?>
    </div>
    
    <div class="col-sm-4">
        <?php echo $form->field($model, 'translation')->textInput() ?>
    </div>
    <div class="form-group">
        <?php echo Html::submitButton($model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary','style'=>"margin-top: 50px;margin-left:100px"]) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
